package cate.game.pvp.gradepvp.msg;

import cate.common.util.GameResult;
import cate.game.GameBody;
import cate.game.client.ClientContext;
import cate.game.client.msg.ClientMsg;
import cate.game.client.msg.MsgConfig;
import cate.game.client.msg.MsgInput;
import cate.game.client.msg.id.MsgIdBGradePvp;
import easy.java.dev.note.NoteField;

@ClientMsg(title = "领取段位首达奖励 の 请求")
public class GradePvpGetRewardReq implements MsgInput {
    @NoteField(value = "奖励id")
    public int tid;

    @Override
    public void execute(GameBody game, ClientContext cc) {
        cc.getRole().getPvp().gradePvp.checkOpen();
        if(!cc.getRole().getPvp().gradePvp.isOpen()){
            game.notice.message(cc.getRole(), "功能未开启");
            return;
        }
        GameResult<Void> r = cc.getRole().getPvp().gradePvp.getReward(tid);
        game.notice.message(cc.getRole(), r, true);
    }

    @Override
    public MsgConfig conf() {
        return MsgIdBGradePvp.GET_REWARD_REQ;
    }
}
